import axios from 'axios'
import { Storage } from '../../storage'

const createCourse = (form) => axios.post('/api/course/info', form, {
    headers: {
        "nothing-token": Storage.get("nothing-token")
    }
}).then(res => res.data)

const getMyCourse = () => axios.get('/api/course/my', {
    headers: {
        "nothing-token": Storage.get("nothing-token")
    }
}).then(res => res.data)

const getCourseInfoById = (courseId) => axios.get(`/api/course/info/${courseId}`).then(res => res.data)

const updateCourse = (form) => axios.put('/api/course/info', form).then(res => res.data)

const deleteTheCourse = courseId => axios.delete(`/api/course/info/${courseId}`).then(res => res.data)

const getStusInCourse = (courseId) => axios.get(`/api/course/info/stus/${courseId}`).then(res => res.data)

const putNotice = (form) => axios.post('/api/notice/put', form).then(res => res.data)

const getWorkCondition = courseId => axios.get(`/api/course/condition/work/${courseId}`).then(res => res.data)

export {
    createCourse,
    getMyCourse,
    getCourseInfoById,
    updateCourse,
    deleteTheCourse,
    getStusInCourse,
    putNotice,
    getWorkCondition
}